import fetch from 'common/src/utils/fetch'
//  获取列表数据
function getTableDatas(data){
    return fetch({
        url:'/api/electionservice/elcMutualCourses/page',
        data,
        method:'post',
      
    })
}

/**
 *获取互选课程数量
 */
function count(calendarId,mode) {
    return fetch({
        url: '/api/electionservice/elcMutualCourses/count?calendarId='+calendarId+'&mode='+mode,
        method: 'post',
    });
}


/**
 *新增
 */
function add(calendarId,courseList,mode) {
    return fetch({
        url: '/api/electionservice/elcMutualCourses/add',
        params:{calendarId: calendarId,courseList: courseList,mode:mode},
        method: 'post',
    });
}

/**
 *批量新增
 */
function addByCondition(calendarId,college,mode) {
    return fetch({
        url: '/api/electionservice/elcMutualCourses/batchAdd',
        params:{calendarId: calendarId,college: college,mode:mode},
        method: 'post',
    });
}

/**
 *添加所有
 */
function addAll(calendarId,mode) {
    return fetch({
        url: '/api/electionservice/elcMutualCourses/addAll',
        params:{calendarId:calendarId,mode:mode},
        method: 'post',
    });
}


/**
 *删除
 */
function deleteData(data) {
    return fetch({
        url: '/api/electionservice/elcMutualCourses/delete',
        data:data,
        method: 'post',
    });
}

/**
 *删除全部
 */
function deleteAll(calendarId,mode) {
    return fetch({
        url: '/api/electionservice/elcMutualCourses/deleteAll',
        params:{calendarId:calendarId,mode:mode},
        method: 'post',
    });
}

/*
 * 查询数据字典
 * @param data
 */
export function queryDicData(data,authId) {
    if (authId) {
        data['authId'] = authId;
    }
    return fetch({
        url: '/api/commonservice/dictionary/query',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    });
}

export default {
    getTableDatas,
    "count": count,
    "add":add,
    "addByCondition":addByCondition,
    "addAll":addAll,
    "deleteData":deleteData,
    "deleteAll":deleteAll,
    'pageUrl': '/api/electionservice/elcMutualCourses/page',
    queryDicData:queryDicData
}



